#ifndef _HOMEGRID_H_
#define _HOMEGRID_H_

#include <string>
#include <osg/Geode>
#include <osg/Geometry>

class HomeGrid
{
public:
	static const std::string Name;

public:
	HomeGrid();

	void setDimensions(const osg::Vec2s& dimensions);
	void setTexture(const std::string& texturePath);

	osg::Node* getNode() const { return m_rGeode.get(); }
	const osg::Vec2s& getGridDimensions() const { return m_Dimensions; }
	const std::string& getTexture() const { return m_TexturePath; }

private:
	osg::Vec2s m_Dimensions;
	std::string m_TexturePath;
	osg::ref_ptr<osg::Geode> m_rGeode;
	osg::ref_ptr<osg::Geometry> m_rQuad;
	osg::ref_ptr<osg::Geometry> m_rLines;

private:
	void updateQuadDimensions(const osg::Vec2& size, const osg::Vec3& offset);
	void updateLines(const osg::Vec2s& dim, const osg::Vec3& offset);
	static osg::ref_ptr<osg::Geometry> createQuad();
	static osg::ref_ptr<osg::Geometry> createLines(int widthCount, int depthCount, const osg::Vec3& offset);
};

#endif